<header id="header" class="text-center row justify-content-center">
    <nav class="navbar navbar-expand-lg px-4">
        {include 'logo.latte'}

        <div class="d-flex align-items-center gap-4">
            <ul class="navbar-nav">
                {include 'theme-toggler.latte'}
            </ul>

            <button
                class="navbar-toggler"
                type="button"
                data-bs-toggle="collapse"
                data-bs-target="#main_navBarFlight"
                aria-controls="main_navBarFlight"
                aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
                <span class="visually-hidden">Toggle navigation</span>
            </button>
        </div>

        <div class="collapse navbar-collapse" id="main_navBarFlight">
            <ul class="navbar-nav ms-auto my-4 my-md-0" id="nav">
                {var $navItems = [
                [['', '/'], 'about'],
                [['/install'], 'install'],
                [['/learn'], 'learn'],
                [['/media'], 'media'],
                [['/examples'], 'examples'],
				[['/guides'], 'guides'],
                [['/awesome-plugins'], 'awesome_plugins']
                ]}

                {foreach $navItems as $item}
				{continueIf in_array($item[1], ['media', 'examples', 'awesome_plugins']) && $version === 'v2'}
                <li class="nav-item">
                    <a
                        n:class="($item[0][0] && strpos(Flight::request()->url, $item[0][0]) !== false) || (strlen(Flight::request()->url) === 6 && isset($item[0][1]) === true) ? 'active', nav-link"
                        href="{Flight::getUrl($item[1])}">
                        {_$item[1]}
                    </a>
                </li>
                {/foreach}

				<!-- Version Dropdown -->
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="versionDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        {_'version'}
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="versionDropdown">
                        <li><a n:class="$version == 'v3' ? 'text-primary', dropdown-item" href="/v3">v3</a></li>
                        <li><a n:class="$version == 'v2' ? 'text-primary', dropdown-item" href="/v2">v2</a></li>
                    </ul>
                </li>

                <li class="nav-item">
                    <a class="nav-link" href="https://github.com/flightphp/core"
                        target="_blank">
                        {_'code'}
                    </a>
                </li>
            </ul>
        </div>
    </nav>
</header>
